package com.zlp.dto.test;
import com.google.common.collect.Lists;

import cn.hutool.core.collection.CollectionUtil;
import com.zlp.common.exception.ServiceException;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * @Classname SupplierSkuDTO
 * @Description 电子卡券订单提交
 * @Date 2022/9/21 21:01
 * @Created by ZouLiPing
 */
@Data
@NoArgsConstructor
public class SupplierCouponCreateReq extends SupplierCodeDTO {

    /**
     *  供应商订单号
     */
    private String cusOrderNo;

    /**
     * 购买详情
     */
    private List<CusSkuDetail> cusSkuList;

    @Override
    public void validate() {
        super.validate();
        if (Objects.isNull(cusOrderNo)) {
            throw new ServiceException("供应商编号不能为空");
        }
        if (CollectionUtil.isEmpty(cusSkuList)) {
            throw new ServiceException("购买三方卡券详情为空");
        }

    }

    @Data
    public static class  CusSkuDetail implements Serializable{

        /**
         *  商品编号
         */
        private String cusSkuNo;
        /**
         *  购买数量
         */
        private Integer skuNum;
    }





}
